Analyzing life expectancy vary and GDP per capita by decades

Team Work

How does life expectancy vary by continent and by decade?

data_by_decade<- function(dataset){
  dataset$decade <- cut(dataset$year, seq(1950,2010,10),labels = as.character(seq(1950,2000,10)))
  return(dataset)
}

fun_continents <- function(continent, decade) {
 
  a <- gapminder_unfiltered[which(gapminder_unfiltered$continent == continent & gapminder_unfiltered$decade == decade),]
  
  stats <- c(min = min(a$lifeExp), max =max( a$lifeExp),
                  mean =  mean(a$lifeExp), median = median(a$lifeExp),
                   IQR = quantile(a$lifeExp, 0.75) - quantile(a$lifeExp, 0.25))
  return(stats)
}
fun_continents( "Africa", 1950)
## Warning: Unknown or uninitialised column: 'decade'.
## Warning in min(a$lifeExp): no non-missing arguments to min; returning Inf
## Warning in max(a$lifeExp): no non-missing arguments to max; returning -Inf
##     min     max    mean  median IQR.75% 
##     Inf    -Inf     NaN      NA      NA
gapminder_unfiltered <- data_by_decade(gapminder_unfiltered)

continentdata <- c()
sta <- c()

for(continent in levels(gapminder_unfiltered$continent)) {
  for(decade in levels(gapminder_unfiltered$decade)) {
    continentdata <- rbind(continentdata, c(continent, decade))
    sta <- rbind(sta, fun_continents(continent, decade ))
  }
}
## Warning in min(a$lifeExp): no non-missing arguments to min; returning Inf

## Warning in min(a$lifeExp): no non-missing arguments to max; returning -Inf
continentdata
##       [,1]       [,2]  
##  [1,] "Africa"   "1950"
##  [2,] "Africa"   "1960"
##  [3,] "Africa"   "1970"
##  [4,] "Africa"   "1980"
##  [5,] "Africa"   "1990"
##  [6,] "Africa"   "2000"
##  [7,] "Americas" "1950"
##  [8,] "Americas" "1960"
##  [9,] "Americas" "1970"
## [10,] "Americas" "1980"
## [11,] "Americas" "1990"
## [12,] "Americas" "2000"
## [13,] "Asia"     "1950"
## [14,] "Asia"     "1960"
## [15,] "Asia"     "1970"
## [16,] "Asia"     "1980"
## [17,] "Asia"     "1990"
## [18,] "Asia"     "2000"
## [19,] "Europe"   "1950"
## [20,] "Europe"   "1960"
## [21,] "Europe"   "1970"
## [22,] "Europe"   "1980"
## [23,] "Europe"   "1990"
## [24,] "Europe"   "2000"
## [25,] "FSU"      "1950"
## [26,] "FSU"      "1960"
## [27,] "FSU"      "1970"
## [28,] "FSU"      "1980"
## [29,] "FSU"      "1990"
## [30,] "FSU"      "2000"
## [31,] "Oceania"  "1950"
## [32,] "Oceania"  "1960"
## [33,] "Oceania"  "1970"
## [34,] "Oceania"  "1980"
## [35,] "Oceania"  "1990"
## [36,] "Oceania"  "2000"
sta
##          min    max     mean  median  IQR.75%
##  [1,] 30.000 58.089 40.38072 40.1790  6.68475
##  [2,] 32.767 61.557 44.51384 44.0780  8.11725
##  [3,] 35.400 67.064 48.70841 48.5635  9.44625
##  [4,] 38.445 71.913 52.66606 51.6395 12.22850
##  [5,] 23.599 74.772 53.75709 52.6440 12.69200
##  [6,] 39.193 76.442 54.38402 52.7115 12.60675
##  [7,] 37.579 71.040 58.28277 59.3110 18.66825
##  [8,] 43.428 72.650 62.39196 64.9255 13.39925
##  [9,] 46.714 75.140 66.09017 67.5225 10.49500
## [10,] 51.461 77.510 69.31884 70.6695  8.96975
## [11,] 55.089 79.420 71.74211 72.4920  7.37325
## [12,] 58.137 80.653 73.60153 74.2390  6.47400
## [13,] 28.801 67.840 50.37611 48.4630 18.71600
## [14,] 31.997 72.070 56.03758 56.2270 18.03950
## [15,] 31.220 76.210 61.28064 62.8954 14.12175
## [16,] 39.854 79.040 65.95619 67.1230 13.16800
## [17,] 41.674 81.350 68.69615 70.1215 12.05050
## [18,] 42.129 82.670 70.95151 72.1990 11.57725
## [19,] 43.585 74.090 67.80427 68.3700  5.07000
## [20,] 52.098 74.700 70.41874 70.4350  2.86250
## [21,] 57.005 76.710 72.18054 72.1300  3.50700
## [22,] 61.036 78.150 73.94292 74.5800  4.72400
## [23,] 66.146 79.990 75.49946 76.4800  4.81000
## [24,] 67.922 81.757 77.47489 78.4600  4.51250
## [25,]    Inf   -Inf      NaN      NA       NA
## [26,] 66.654 71.200 70.10200 70.4600  0.78000
## [27,] 68.158 72.710 69.92763 69.5420  1.07250
## [28,] 69.130 71.370 70.18112 70.0800  1.48500
## [29,] 62.959 72.140 68.30447 68.5700  2.75000
## [30,] 64.878 72.962 68.88362 68.6500  4.16475
## [31,] 68.720 71.260 70.18650 70.2950  0.94250
## [32,] 49.690 71.550 67.01100 70.9800  5.79500
## [33,] 42.522 74.600 66.90520 71.7800 10.84150
## [34,] 52.460 77.060 69.53376 73.7900  9.53325
## [35,] 55.186 79.990 72.36039 76.2650 11.20900
## [36,] 56.651 81.235 72.50648 73.0100 10.79000
s <- data.frame(continentdata, sta )
names(s)[1] <- "continent"
names(s)[2] <- "decade"
s
##    continent decade    min    max     mean  median  IQR.75.
## 1     Africa   1950 30.000 58.089 40.38072 40.1790  6.68475
## 2     Africa   1960 32.767 61.557 44.51384 44.0780  8.11725
## 3     Africa   1970 35.400 67.064 48.70841 48.5635  9.44625
## 4     Africa   1980 38.445 71.913 52.66606 51.6395 12.22850
## 5     Africa   1990 23.599 74.772 53.75709 52.6440 12.69200
## 6     Africa   2000 39.193 76.442 54.38402 52.7115 12.60675
## 7   Americas   1950 37.579 71.040 58.28277 59.3110 18.66825
## 8   Americas   1960 43.428 72.650 62.39196 64.9255 13.39925
## 9   Americas   1970 46.714 75.140 66.09017 67.5225 10.49500
## 10  Americas   1980 51.461 77.510 69.31884 70.6695  8.96975
## 11  Americas   1990 55.089 79.420 71.74211 72.4920  7.37325
## 12  Americas   2000 58.137 80.653 73.60153 74.2390  6.47400
## 13      Asia   1950 28.801 67.840 50.37611 48.4630 18.71600
## 14      Asia   1960 31.997 72.070 56.03758 56.2270 18.03950
## 15      Asia   1970 31.220 76.210 61.28064 62.8954 14.12175
## 16      Asia   1980 39.854 79.040 65.95619 67.1230 13.16800
## 17      Asia   1990 41.674 81.350 68.69615 70.1215 12.05050
## 18      Asia   2000 42.129 82.670 70.95151 72.1990 11.57725
## 19    Europe   1950 43.585 74.090 67.80427 68.3700  5.07000
## 20    Europe   1960 52.098 74.700 70.41874 70.4350  2.86250
## 21    Europe   1970 57.005 76.710 72.18054 72.1300  3.50700
## 22    Europe   1980 61.036 78.150 73.94292 74.5800  4.72400
## 23    Europe   1990 66.146 79.990 75.49946 76.4800  4.81000
## 24    Europe   2000 67.922 81.757 77.47489 78.4600  4.51250
## 25       FSU   1950    Inf   -Inf      NaN      NA       NA
## 26       FSU   1960 66.654 71.200 70.10200 70.4600  0.78000
## 27       FSU   1970 68.158 72.710 69.92763 69.5420  1.07250
## 28       FSU   1980 69.130 71.370 70.18112 70.0800  1.48500
## 29       FSU   1990 62.959 72.140 68.30447 68.5700  2.75000
## 30       FSU   2000 64.878 72.962 68.88362 68.6500  4.16475
## 31   Oceania   1950 68.720 71.260 70.18650 70.2950  0.94250
## 32   Oceania   1960 49.690 71.550 67.01100 70.9800  5.79500
## 33   Oceania   1970 42.522 74.600 66.90520 71.7800 10.84150
## 34   Oceania   1980 52.460 77.060 69.53376 73.7900  9.53325
## 35   Oceania   1990 55.186 79.990 72.36039 76.2650 11.20900
## 36   Oceania   2000 56.651 81.235 72.50648 73.0100 10.79000

From the table, we can see the life expectancy is increasing by decades for each continent. But the IQR for developing countries, like in Asia increase first and then decrease a littel bit. And for Europe and Americas, the IQR doesn’t change a lot, it’s steady.

Now, we can consider plots to look into this further.

Europe <- subset(gapminder_unfiltered, continent == "Europe")
Africa <- subset(gapminder_unfiltered, continent == "Africa")
Asia <- subset(gapminder_unfiltered, continent == "Asia")
Americas <- subset(gapminder_unfiltered, continent == "Americas")
Oceania <- subset(gapminder_unfiltered, continent == "Oceania")
aggregate(lifeExp~continent, gapminder_unfiltered, min)
##   continent lifeExp
## 1    Africa  23.599
## 2  Americas  37.579
## 3      Asia  28.801
## 4    Europe  43.585
## 5       FSU  57.300
## 6   Oceania  42.522
aggregate(lifeExp~continent, gapminder_unfiltered, max)
##   continent lifeExp
## 1    Africa  76.442
## 2  Americas  80.653
## 3      Asia  82.670
## 4    Europe  81.757
## 5       FSU  72.962
## 6   Oceania  81.235
aggregate(lifeExp~continent, gapminder_unfiltered, mean)
##   continent  lifeExp
## 1    Africa 49.03680
## 2  Americas 67.09195
## 3      Asia 62.41587
## 4    Europe 72.72164
## 5       FSU 68.84430
## 6   Oceania 69.74691
aggregate(lifeExp~continent, gapminder_unfiltered, median)
##   continent lifeExp
## 1    Africa 47.9240
## 2  Americas 69.4855
## 3      Asia 64.3330
## 4    Europe 72.7650
## 5       FSU 69.1100
## 6   Oceania 70.9900
aggregate(lifeExp~continent, gapminder_unfiltered, IQR)
##   continent  lifeExp
## 1    Africa 12.18600
## 2  Americas 10.92950
## 3      Asia 16.19825
## 4    Europe  5.76250
## 5       FSU  2.71050
## 6   Oceania  7.69600
filter(gapminder_unfiltered,(continent=="Europe" & year<1970 & year >= 1960)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Europe" & year<1980 & year >= 1970)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Europe" & year<1990 & year >= 1980)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Europe" & year<2000 & year >= 1990)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Europe" & year<2010 & year >= 2000)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Africa" & year<1970 & year >= 1960)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Africa" & year<1980 & year >= 1970)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Africa" & year<1990 & year >= 1980)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Africa" & year<2000 & year >= 1990)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Africa" & year<2010 & year >= 2000)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Asia" & year<1970 & year >= 1960)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Asia" & year<1980 & year >= 1970)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Asia" & year<1990 & year >= 1980)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Asia" & year<2000 & year >= 1990)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Asia" & year<2010 & year >= 2000)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Americas" & year<1970 & year >= 1960)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Americas" & year<1980 & year >= 1970)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Americas" & year<1990 & year >= 1980)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Americas" & year<2000 & year >= 1990)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Americas" & year<2010 & year >= 2000)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Oceania" & year<1970 & year >= 1960)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Oceania" & year<1980 & year >= 1970)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Oceania" & year<1990 & year >= 1980)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Oceania" & year<2000 & year >= 1990)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

filter(gapminder_unfiltered,(continent=="Oceania" & year<2010 & year >= 2000)) %>%
  ggplot() +
  geom_freqpoly(aes(x=lifeExp),binwidth=1)

How does GDP per capita vary by continent and by decade?

europe <- subset(gapminder_unfiltered, continent == "Europe")
africa <- subset(gapminder_unfiltered, continent == "Africa")
asia <- subset(gapminder_unfiltered, continent == "Asia")
americas <- subset(gapminder_unfiltered, continent == "Americas")
oceania <- subset(gapminder_unfiltered, continent == "Oceania")
aggregate(gdpPercap~continent, gapminder_unfiltered, min)
##   continent gdpPercap
## 1    Africa  241.1659
## 2  Americas 1201.6372
## 3      Asia  331.0000
## 4    Europe  973.5332
## 5       FSU 1442.9378
## 6   Oceania  864.9743
aggregate(gdpPercap~continent, gapminder_unfiltered, max)
##   continent gdpPercap
## 1    Africa  21951.21
## 2  Americas  42951.65
## 3      Asia 113523.13
## 4    Europe  70014.00
## 5       FSU  16666.51
## 6   Oceania  36383.17
aggregate(gdpPercap~continent, gapminder_unfiltered, mean)
##   continent gdpPercap
## 1    Africa  2175.859
## 2  Americas 10802.574
## 3      Asia 10073.938
## 4    Europe 16551.178
## 5       FSU  7326.686
## 6   Oceania 14057.097
aggregate(gdpPercap~continent, gapminder_unfiltered, median)
##   continent gdpPercap
## 1    Africa  1190.844
## 2  Americas  6924.750
## 3      Asia  3273.138
## 4    Europe 14433.025
## 5       FSU  7050.027
## 6   Oceania 14526.125
aggregate(gdpPercap~continent, gapminder_unfiltered, IQR)
##   continent gdpPercap
## 1    Africa  1614.533
## 2  Americas 10807.514
## 3      Asia 11784.104
## 4    Europe 13647.275
## 5       FSU  4507.156
## 6   Oceania 15544.632
filter(gapminder_unfiltered,(continent=="Europe" & year<1970 & year >= 1960)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Europe" & year<1980 & year >= 1970)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Europe" & year<1990 & year >= 1980)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Europe" & year<2000 & year >= 1990)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Europe" & year<2010 & year >= 2000)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Africa" & year<1970 & year >= 1960)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Africa" & year<1980 & year >= 1970)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Africa" & year<1990 & year >= 1980)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Africa" & year<2000 & year >= 1990)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Africa" & year<2010 & year >= 2000)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Asia" & year<1970 & year >= 1960)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Asia" & year<1980 & year >= 1970)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Asia" & year<1990 & year >= 1980)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Asia" & year<2000 & year >= 1990)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Asia" & year<2010 & year >= 2000)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Americas" & year<1970 & year >= 1960)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Americas" & year<1980 & year >= 1970)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Americas" & year<1990 & year >= 1980)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Americas" & year<2000 & year >= 1990)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Americas" & year<2010 & year >= 2000)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Oceania" & year<1970 & year >= 1960)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Oceania" & year<1980 & year >= 1970)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Oceania" & year<1990 & year >= 1980)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Oceania" & year<2000 & year >= 1990)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

filter(gapminder_unfiltered,(continent=="Oceania" & year<2010 & year >= 2000)) %>%
  ggplot() +
  geom_freqpoly(aes(x=gdpPercap),binwidth=1)

fun_gdp <- function(continent, decade) {
  
  a <- gapminder_unfiltered[which(gapminder_unfiltered$continent == continent & gapminder_unfiltered$decade == decade),]
  
  stats2 <- c(min = min(a$gdpPercap), max =max( a$gdpPercap),
             mean =  mean(a$gdpPercap), median = median(a$gdpPercap),
             IQR = quantile(a$gdpPercap, 0.75) - quantile(a$gdpPercap, 0.25))
  return(stats2)
}
fun_gdp("Africa",1950)
##       min       max      mean    median   IQR.75% 
##  298.8462 5487.1042 1305.1360  982.0428  917.0443
gap <- data_by_decade(gapminder_unfiltered)

continentgdp <- c()
sta2<- c()
for(continent in levels(gap$continent)) {
  for(decade in levels(gap$decade)) {
    continentgdp <- rbind(continentgdp, c(continent, decade))
    sta2 <- rbind(sta2, fun_gdp(continent, decade ))
  }
}
## Warning in min(a$gdpPercap): no non-missing arguments to min; returning Inf
## Warning in max(a$gdpPercap): no non-missing arguments to max; returning -
## Inf
continentgdp
##       [,1]       [,2]  
##  [1,] "Africa"   "1950"
##  [2,] "Africa"   "1960"
##  [3,] "Africa"   "1970"
##  [4,] "Africa"   "1980"
##  [5,] "Africa"   "1990"
##  [6,] "Africa"   "2000"
##  [7,] "Americas" "1950"
##  [8,] "Americas" "1960"
##  [9,] "Americas" "1970"
## [10,] "Americas" "1980"
## [11,] "Americas" "1990"
## [12,] "Americas" "2000"
## [13,] "Asia"     "1950"
## [14,] "Asia"     "1960"
## [15,] "Asia"     "1970"
## [16,] "Asia"     "1980"
## [17,] "Asia"     "1990"
## [18,] "Asia"     "2000"
## [19,] "Europe"   "1950"
## [20,] "Europe"   "1960"
## [21,] "Europe"   "1970"
## [22,] "Europe"   "1980"
## [23,] "Europe"   "1990"
## [24,] "Europe"   "2000"
## [25,] "FSU"      "1950"
## [26,] "FSU"      "1960"
## [27,] "FSU"      "1970"
## [28,] "FSU"      "1980"
## [29,] "FSU"      "1990"
## [30,] "FSU"      "2000"
## [31,] "Oceania"  "1950"
## [32,] "Oceania"  "1960"
## [33,] "Oceania"  "1970"
## [34,] "Oceania"  "1980"
## [35,] "Oceania"  "1990"
## [36,] "Oceania"  "2000"
sta2
##              min        max      mean     median    IQR.75%
##  [1,]   298.8462   5487.104  1305.136   982.0428   917.0443
##  [2,]   355.2032  18772.752  1803.591  1170.4843  1088.2434
##  [3,]   464.0995  21951.212  2429.133  1351.0225  1682.5797
##  [4,]   389.8762  17364.275  2362.302  1286.1727  1950.4980
##  [5,]   312.1884  14722.842  2326.214  1186.1480  2025.2945
##  [6,]   241.1659  13206.485  2844.420  1340.3506  2732.7562
##  [7,]  1397.7171  15374.018  6515.719  4020.1861  8892.1625
##  [8,]  1452.0577  20702.828  8019.659  5213.4317 10993.9097
##  [9,]  1654.4569  25672.012 10109.298  6621.1344 13242.5668
## [10,]  1823.0160  31880.959 12040.224  7352.7580 17433.4639
## [11,]  1341.7269  39025.863 13843.705  7777.0534 20556.4788
## [12,]  1201.6372  42951.653 13809.123  8797.6407 12946.5861
## [13,]   331.0000 113523.133  4612.884  1487.5935  2469.8728
## [14,]   349.0000  95458.112  5390.930  2033.0565  5078.8165
## [15,]   357.0000 109347.867 10558.312  3692.2265 11673.9697
## [16,]   385.0000  62407.211 11416.603  6642.8814 16923.4615
## [17,]   347.0000  52938.653 12858.720  6454.2308 20557.5102
## [18,]   611.0000  82010.978 15087.881  5062.9683 23020.0301
## [19,]   973.5332  19059.005  7615.712  7205.5610  4799.3791
## [20,]  1709.6837  25862.819 11147.301 10837.7298  6601.6014
## [21,]  2860.1698  28732.366 15491.151 15610.7483  9021.4983
## [22,]  3630.8807  42467.638 18957.139 19297.6029 10892.9321
## [23,]  1830.2944  63924.163 21731.224 22979.6148 15067.3528
## [24,]  1933.6473  70014.000 26019.765 27987.1098 16308.4509
## [25,]        Inf       -Inf       NaN         NA         NA
## [26,]  3029.7991   5470.687  4340.394  4444.3439   529.1452
## [27,]  3741.2261  11523.459  7092.228  6850.5960  1694.1270
## [28,]  6359.8299  13148.258  9431.813  9549.6922  1827.2758
## [29,]  1442.9378  12374.359  6378.065  6340.1208  3610.4404
## [30,]  1724.2955  16666.509  8660.943  9244.0066  5756.4405
## [31,] 10039.5956  13039.678 11322.296 11107.5436  1416.6949
## [32,]  1219.9966  20213.733 12059.751 13860.9581  2439.6813
## [33,]   864.9743  32001.307 13375.365 16633.4424 14103.5449
## [34,]  1467.3960  24837.871 14018.739 18740.6375 16794.8329
## [35,]  1880.9606  36383.170 16630.736 20768.7922 20147.2571
## [36,]  1530.4961  34435.367 15641.465  5565.1469 24343.7237
s2 <- data.frame(continentgdp,sta2)
names(s2)[1] <- "continent"
names(s2)[2] <- "decade"
s2
##    continent decade        min        max      mean     median    IQR.75.
## 1     Africa   1950   298.8462   5487.104  1305.136   982.0428   917.0443
## 2     Africa   1960   355.2032  18772.752  1803.591  1170.4843  1088.2434
## 3     Africa   1970   464.0995  21951.212  2429.133  1351.0225  1682.5797
## 4     Africa   1980   389.8762  17364.275  2362.302  1286.1727  1950.4980
## 5     Africa   1990   312.1884  14722.842  2326.214  1186.1480  2025.2945
## 6     Africa   2000   241.1659  13206.485  2844.420  1340.3506  2732.7562
## 7   Americas   1950  1397.7171  15374.018  6515.719  4020.1861  8892.1625
## 8   Americas   1960  1452.0577  20702.828  8019.659  5213.4317 10993.9097
## 9   Americas   1970  1654.4569  25672.012 10109.298  6621.1344 13242.5668
## 10  Americas   1980  1823.0160  31880.959 12040.224  7352.7580 17433.4639
## 11  Americas   1990  1341.7269  39025.863 13843.705  7777.0534 20556.4788
## 12  Americas   2000  1201.6372  42951.653 13809.123  8797.6407 12946.5861
## 13      Asia   1950   331.0000 113523.133  4612.884  1487.5935  2469.8728
## 14      Asia   1960   349.0000  95458.112  5390.930  2033.0565  5078.8165
## 15      Asia   1970   357.0000 109347.867 10558.312  3692.2265 11673.9697
## 16      Asia   1980   385.0000  62407.211 11416.603  6642.8814 16923.4615
## 17      Asia   1990   347.0000  52938.653 12858.720  6454.2308 20557.5102
## 18      Asia   2000   611.0000  82010.978 15087.881  5062.9683 23020.0301
## 19    Europe   1950   973.5332  19059.005  7615.712  7205.5610  4799.3791
## 20    Europe   1960  1709.6837  25862.819 11147.301 10837.7298  6601.6014
## 21    Europe   1970  2860.1698  28732.366 15491.151 15610.7483  9021.4983
## 22    Europe   1980  3630.8807  42467.638 18957.139 19297.6029 10892.9321
## 23    Europe   1990  1830.2944  63924.163 21731.224 22979.6148 15067.3528
## 24    Europe   2000  1933.6473  70014.000 26019.765 27987.1098 16308.4509
## 25       FSU   1950        Inf       -Inf       NaN         NA         NA
## 26       FSU   1960  3029.7991   5470.687  4340.394  4444.3439   529.1452
## 27       FSU   1970  3741.2261  11523.459  7092.228  6850.5960  1694.1270
## 28       FSU   1980  6359.8299  13148.258  9431.813  9549.6922  1827.2758
## 29       FSU   1990  1442.9378  12374.359  6378.065  6340.1208  3610.4404
## 30       FSU   2000  1724.2955  16666.509  8660.943  9244.0066  5756.4405
## 31   Oceania   1950 10039.5956  13039.678 11322.296 11107.5436  1416.6949
## 32   Oceania   1960  1219.9966  20213.733 12059.751 13860.9581  2439.6813
## 33   Oceania   1970   864.9743  32001.307 13375.365 16633.4424 14103.5449
## 34   Oceania   1980  1467.3960  24837.871 14018.739 18740.6375 16794.8329
## 35   Oceania   1990  1880.9606  36383.170 16630.736 20768.7922 20147.2571
## 36   Oceania   2000  1530.4961  34435.367 15641.465  5565.1469 24343.7237

The highest GDP per capita lies in developed countries, and their changes a smaller than Asia. But Asia has a great increase by decades.

Summary of Who did What

Lauren

Kaite

I used several functions to form two tables, one is for the changes of life expectancy by continents by decade, and another is the changes of GDP per capita by continent by decades. And those two tables illustrated 5 statsitics for each decade and continent. We could see the increaseing tendency of changing of life expectancy from those continents, especially Asia. And the great increasing in GDP in Asia too.

Ryan

Chris

I tried to analysis the 5 decades the life expectancy and the gdp per capita, first time I just used subset to five indiviual continent and use the aggregate function tried to calculate the answer, but the only things that i can find is the averge answer durning the whole time and I stuck in every decades, so I used another way tried to find the relation durning the plots. for each question I created 5*5 plots. 5 contients and 5 decedes, and from the graphs that I got, it is really easy to conclude that the life expectancy and the cgp per capita increase when the years increase.